<?php
/**
 * Created by PhpStorm.
 * User: g
 * Date: 2017/4/27
 * Time: 14:51
 */

namespace app\front\controller;


use app\common\controller\Base;
use think\Loader;

class Home extends Base
{
    public $user = null;
    public $userId = 0;
    public function __construct()
    {
        parent::__construct();
        $this->initializeCheck();
    }
    protected function initializeCheck(){
        $user = Loader::model('AccountRegistration');
        $userId = intval(session("u_id"));
        if($userId){
            $user_info = $user->find($userId);
            if($user_info){
                $this->user = $user;
                $this->userId = $userId;
                $this->assign("user",$user_info->toArray());
                return true;
            }
        }
        $this->error("未登录",url("login/login"));


    }




}